<template>
  <div>
    <el-form ref="financeAccountQueryForm" :model="financeAccountQueryData" :rules="financeAccountQueryRules"
             size="mini" label-width="65px">
      <el-row :gutter="20">
        <el-col :span="1">
          <el-tag>记账</el-tag>
        </el-col>
        <el-col :span="5">
          <el-form-item label="记账客户" prop="accountCusId">
            <el-select v-model="financeAccountQueryData.accountCusId" placeholder="请输入关键字搜索" clearable filterable remote :remote-method="remoteCustomer"
                       :style="{width: '100%'}">
              <el-option v-for="item in customerIdOptions" :key="item.id" :label="item.text" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="服务商" prop="accountServicerId" style="margin-bottom: 0px;">
            <el-select v-model="financeAccountQueryData.accountServicerId" placeholder="请输入关键字搜索" clearable filterable remote :remote-method="remoteServicerCompany"
                       :style="{width: '100%'}">
              <el-option v-for="item in serviceCompanyOptions" :key="item.id" :label="item.text" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-row>
            <el-col :span="13">
              <el-form-item label="记账日期" prop="rangeAccountTime">
                <el-date-picker v-model="financeAccountQueryData.rangeAccountTime[0]" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                :style="{width: '100%'}" placeholder="开始日期" clearable></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="11">
              <el-form-item label="-" prop="rangeAccountTime" label-width="30px">
                <el-date-picker v-model="financeAccountQueryData.rangeAccountTime[1]" format="yyyy-MM-dd" value-format="yyyy-MM-dd"
                                :style="{width: '100%'}" placeholder="结束日期" clearable></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>

          <el-form-item label="记账银行" prop="bankAccountId" style="margin-bottom: 0px;">
            <el-select v-model="financeAccountQueryData.bankAccountId" placeholder="请选择记账银行" clearable filterable
                       :style="{width: '100%'}">
              <el-option v-for="(item, value) in statementSource.companyBankMap" :key="value" :label="item" :value="value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="7">
          <el-form-item label="记账编号" prop="accountNos" style="margin-bottom: 0px;">
            <el-input v-model="financeAccountQueryData.accountNos" type="textarea"
                      :autosize="{minRows: 3, maxRows: 3}" :style="{width: '100%'}"></el-input>
          </el-form-item>
        </el-col>
      </el-row>


    </el-form>
  </div>
</template>
<script>
  import { ajax } from "@/store/yg/common/utils";
  export default {
    components: {},
    props: {
      statementSource:{
        type: Object,
        default: function () {
          return {}
        }
      }
    },
    data() {
      return {
        financeAccountQueryData: {
          rangeAccountTime: [],
          accountCusId: null,
          accountServicerId: null,
          bankAccountId: null,
          accountNos: null
        },
        financeAccountQueryRules: {
          rangeAccountTime: [],
          accountCusId: [],
          accountServicerId: [],
          bankAccountId: [],
        },
        customerIdOptions: [],
        serviceCompanyOptions: [],
        bankAccountIdOptions: [],
      }
    },
    created() {},
    mounted() {},
    methods: {
      async remoteCustomer(query){
        if (query !== '') {
          this.customerIdOptions = await ajax("searchCustomerSelect", {
            name: query
          });
        }else {
          this.customerIdOptions = {};
        }
      },
      async remoteServicerCompany(query){
        if (query !== '') {
          this.serviceCompanyOptions = await ajax("searchServiceCompanySelect", {
            name: query
          });
        }else {
          this.serviceCompanyOptions = {};
        }
      }
    }
  }

</script>
<style>
</style>
